#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import asyncio
import argparse
import logging
import sys

# 添加项目根目录到路径
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))

from app.core.db_init import initialize_database
from app.core.logging import setup_logging


async def main():
    """主函数"""
    # 设置日志
    setup_logging()
    
    # 初始化数据库
    await initialize_database()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="初始化数据库")
    args = parser.parse_args()
    
    # 运行异步主函数
    asyncio.run(main())